package com.example.apple.paopo.activity;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;

import com.example.apple.paopo.R;
import com.example.apple.paopo.base.BaseActivity;
import com.example.apple.paopo.bean.User;
import com.example.apple.paopo.model.UserModel;

import org.xutils.view.annotation.ContentView;
import org.xutils.x;

/**
 * Created by apple on 17/11/30.
 */
@ContentView(R.layout.activity_splash)
public class SplashActivity extends BaseActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        x.view().inject(this);
        Handler handler =new Handler(Looper.getMainLooper());
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                User user = UserModel.getInstance().getCurrentUser();
                if (user == null) {
                    startActivity(LoginActivity.class,null,true);
                }else{
                    startActivity(MainActivity.class,null,true);
                }
            }
        },1000);

    }
}
